package com.zhongnan.Demo3_Date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyDate {
    public static void main(String[] args) throws ParseException {
        // 电脑当前时间
        Date date = new Date();

        System.out.println(date);
        System.out.println(date.getTime());
        // 从家算计的时间原点开始过了多少毫秒的那个时间
        Date date1 = new Date(0l);
        System.out.println(date1);

        SimpleDateFormat spd = new SimpleDateFormat("yyyy/MM/dd");
        String ada = spd.format(date);
        System.out.println(ada);

        String newDate = "2021/01/10";
        SimpleDateFormat spf = new SimpleDateFormat("yyyy/MM/dd");
        System.out.println(spf.parse(newDate));
    }
}
